package com.alks.function.controller.finance.salary;


import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.finance.salary.SalaryStitchInventoryRequest;
import com.alks.function.data.request.finance.salary.SalaryStitchRequest2;
import com.alks.function.service.finance.salary.SalaryStitchInventoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@ApiRestController("/salaryStitchInventory")
@Api(value = "财务部-工厂-人工薪资作业", tags = {"财务部-针车件资作业-2"})
@Slf4j
@RoleCheck(prgIds = {"180303"})
public class SalaryStitchInventoryController {

    @Autowired
    private SalaryStitchInventoryService salaryStitchInventoryService;

    @WebLogger
    @PostMapping("/getLotProductDetails")
    @ApiOperation(value = "指令产量明细查询",tags = "财务部-针车件资作业-2")
    public ResponseInfo getLotProductDetails(@RequestBody SalaryStitchInventoryRequest request){
        return salaryStitchInventoryService.getLotProductDetails(request);
    }

    @WebLogger
    @PostMapping("/getLotProductCount")
    @ApiOperation(value = "查询指令产量明细的完工数量和金额",tags = "财务部-针车件资作业-2")
    public ResponseInfo getLotProductCount(@RequestBody SalaryStitchInventoryRequest request){
        return salaryStitchInventoryService.getLotProductCount(request);
    }

    @WebLogger
    @PostMapping("/getSettleAccounts")
    @ApiOperation(value = "结算确认/取消结算/财务备注",tags = "财务部-针车件资作业-2")
    public ResponseInfo getSettleAccounts(@RequestBody SalaryStitchRequest2 request){
        return salaryStitchInventoryService.getSettleAccounts(request);
    }

    @WebLogger
    @PostMapping("/export")
    @ApiOperation(value = "导出(页面：导出)",tags = "财务部-针车件资作业-2")
    public void export(@RequestBody SalaryStitchInventoryRequest request, HttpServletResponse response) throws IOException {
        salaryStitchInventoryService.export(request,response);
    }

    @WebLogger
    @PostMapping("/exportEmployeeSummary")
    @ApiOperation(value = "导出员工汇总xls(页面：导出员工汇总xls)",tags = "财务部-针车件资作业-2")
    public void exportEmployeeSummary(@RequestBody SalaryStitchInventoryRequest request, HttpServletResponse response) throws IOException {
         salaryStitchInventoryService.exportEmployeeSummary(request,response);
    }

    @WebLogger
    @PostMapping("/exportEmployeeSummaryByPdf")
    @ApiOperation(value = "导出员工汇总pdf(页面：导出员工汇总)",tags = "财务部-针车件资作业-2")
    public ResponseInfo exportEmployeeSummaryByPdf(@RequestBody SalaryStitchInventoryRequest request) {
        return salaryStitchInventoryService.exportEmployeeSummaryByPdf(request);
    }

    @WebLogger
    @PostMapping("/exportMonthSummary")
    @ApiOperation(value = "导出月份汇总xls(导出月份汇总表)",tags = "财务部-针车件资作业-2")
    public void exportMonthSummary(@RequestBody SalaryStitchInventoryRequest request, HttpServletResponse response) throws IOException {
         salaryStitchInventoryService.exportMonthSummary(request,response);
    }


}
